package qc;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Vector;

import org.quickconnect.ControlObject;

import ui.MainFrame;

import beans.CommunicationBean;

import com.mysql.jdbc.Connection;

import controller.ServerConnectionHandler;

public class MuteRoomBCO implements ControlObject 
{
	@Override
	public Object handleIt(ArrayList<Object> arg0) {
		HashMap params = (HashMap) arg0.get(arg0.size()-1);
		Connection con = (Connection) MainFrame.mainFrame.getController().getConnectionPool().getConnection();

		String session = (String) params.get("sessionId");
		java.sql.PreparedStatement update = null;
		try {
			update = con.prepareStatement("UPDATE Session SET SessionMute = CASE SessionMute WHEN 1 THEN 0 ELSE 1 END WHERE SessionNumber = ?");
			update.setString(1, session);
			update.execute();
		} 
		catch (SQLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		return params;
	}

}
